/*
 * @Author: 杨三炮
 * @Date: 2021-11-23 20:03:23
 * @LastEditors: 杨三炮
 * @LastEditTime: 2021-11-24 14:22:23
 * @FilePath: \node\node\routers\teacher.js
 */
const express = require('express')
const router = express()
const passport = require('passport')
const teacher = require('../dao/teacher_dao')

router.get('/', (req, res) => res.send('进入teacher路由'))
//登录
router.post('/login', (req, res) => {
    teacher.Login(req, res)
})

//修改密码
router.post('/upPwd', passport.authenticate('jwt', { session: false }), (req, res) => {
    teacher.upPwd(req, res)
})
//获取个人信息
router.get('/getUserInfo', passport.authenticate('jwt', { session: false }), (req, res) => {
    teacher.getUserInfo(req, res)
})

router.get('/getUser', passport.authenticate('jwt', { session: false }), (req, res) => {
    teacher.getUser(req, res)
})
//更新or插入数据
router.post('/setXlsxData', passport.authenticate('jwt', { session: false }), (req, res) => {
    teacher.setXlsxData(req, res)
})
//更新用户数据
router.post('/upUserdata', passport.authenticate('jwt', { session: false }), (req, res) => {
    teacher.upUserdata(req, res)
})
//根据id删除用户
router.delete('/delUserdata', passport.authenticate('jwt', { session: false }), (req, res) => {
    teacher.delUserdata(req, res)
})
//获取老师管理的班级
router.get('/teacherClass', passport.authenticate('jwt', { session: false }), (req, res) => {
    teacher.teacherClass(req, res)
})
//获取老师管理的班级的请假条
router.get('/getClassLeave', passport.authenticate('jwt', { session: false }), (req, res) => {
    teacher.getClassLeave(req, res)
})


module.exports = router